﻿

using System.Web.Http;
namespace HBase {
    [RoutePrefix("open")]
    public class HServer :BaseApiController {

        //Sys/showLog
        [HttpGet, Route("logger")]
        public BaseResult all() {
            return BaseResult.Ok(LoggerCache.getAll());
        }
        [HttpGet, Route("task")]
        public BaseResult getStat() {
            return BaseResult.Ok(TaskPool.getStat());
        }
        [HttpGet, Route("c/{key}")]
        public BaseResult getCache(string key) {
            if( string.IsNullOrWhiteSpace(key) ) {
                return BaseResult.Ok("启动完成");
            } else if( "a" == key ) {
                return BaseResult.Ok(MyCache.getAll());
            } else {
                MyDict<string ,object> res = new MyDict<string ,object>();
                string[] keys = key.Split(':');
                foreach( string k in keys ) {
                    if( string.IsNullOrWhiteSpace(key) ) {
                        continue;
                    }
                    res.addOverride(k ,MyCache.getAll(k));
                }
                return BaseResult.Ok(res);
            }



        }

    }

}
